package xipujewel.xipujewel.web.account;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import xipujewel.xipujewel.entity.account.User;
import xipujewel.xipujewel.service.account.UserManager;
import xipujewel.xipujewel.utils.UserUtil;

@Controller
@RequestMapping(value = "/index")
public class IndexController {

	@Autowired
	private UserManager userManager;

	@RequestMapping(method = RequestMethod.GET)
	public String index(Model model) {
		String loginName = UserUtil.getCurrentUserLoginName();
		User user = userManager.findByLoginNameAndType01(loginName);
		model.addAttribute("cUser", user);
		return "account/index";
	}

}
